<template lang="html">
	<div class="cart-list">
	  <dl>
	  	<dt>
	  		<div v-if='!checked' class="check uncheck" @click='check'><i class="yo-ico">&#xe72f;</i></div>
	  		<div v-if='checked' class="check" @click='check'><i class="yo-ico">&#xe730;</i></div>	
	  		<div class="center">
	  			<p><i class="yo-ico">&#xe75f;</i>真真小吃外卖</p>
	  			<p>满258免配送费</p>
	  		</div>
	  		<div class="right">未达到配送金额</div>
	  	</dt>
	  	<dd>
	  		<div class="title">
	  			<span>第二件半价</span>
	  			<span>购买两件,其中一件半价优惠</span>
	  		</div>
	  		<div class="content" v-for="(item , index) in this.$store.state.all">
	  			<!--<div>{{this.$store.state.all.sname}}</div>-->
		  		<div v-if='!checked' class="check uncheck" @click='check'><i class="yo-ico">&#xe72f;</i></div>
	  			<div v-if='checked' class="check" @click='check'><i class="yo-ico">&#xe730;</i></div>
		  		<div class="center">
		  			<div class="img"><img :src="item.src" alt=""></div>  
		  			<div class="word">
		  				<div class="name">{{item.sname}}</div>
		  				<div class="size"><span>规格:</span><span>大份</span></div>
		  				<div class="price">
		  					<i class="yo-ico">&#xe635;</i>
		  					<span>{{item.nprice}}</span>
		  					<del>原价<i class="yo-ico">&#xe635;</i><span>{{item.oprice}}</span></del>
		  				</div>
		  			</div>
		  		</div>
		  		<div class='right'>
		  			<i class="yo-ico" @click="sub">&#xe604;</i>
		  			<span>{{num[index]}}</span>
		  			<i class="yo-ico" @click="add(index)">&#xe605;</i>
		  		</div>
	  		</div>
	  	</dd>
	  	<div class="preferential">
	  		<span>满减优惠</span>
	  		<span>满50减5</span>
	  		<span class="right">
	  			<a v-if=false>-50</a>
	  			<a v-if=true>未满足</a>
	  		</span>
	  	</div>
 	  </dl>
 	
	</div>
</template>

<script>

import Vue from 'vue'
import axios from 'axios'

export default {
  data() {
    return {
      num :"",
      checked:"true",
      bbb : "bbb"
    }
  },
  methods: {
	    sub(){
	    	if(this.num == 1){
	    		return;
	    	}else{
	    		this.num--;
	    	}
	    },
	    add(index){
	    	this.num[index]++;
//	    	console.log(this.num)
	    },
	    check(){
	    	this.checked = !this.checked;
	    }
	    
    },
    updated() {
//  	console.log("ok")
    	this.$store.state.num = this.num
    },
    mounted() {
    	this.num = this.$store.state.num
    },
    watch:{
    	num : function(){
    		console.log("a")	
    	}
    },
	props:['ischeck']
}
</script>

